var newsTable;
function getmallList() {
    if (typeof newsTable !== 'undefined') {
        newsTable.fnPageChange('first');
        return;
    }
    var i = 1;
    newsTable = $("#mallList").DataTable({
        "sAjaxSource": _path + "/maid/queryByPage",          
        "fnServerParams": function (aoData) {
            aoData.push(
            	{ "name": "createTime", "value": $("#time").val() },
                { "name": "mch_id", "value": $("#mid").val() }
            );
        },
        "sServerMethod": "POST",
        "sAjaxDataProp": "dataList",
        "fnCreatedRow": function () {
            i++;
        },
        "fnPreDrawCallback": function () {
            i = 1;
        },
        "aoColumns": [
            { "sTitle": "序号", "sWidth": "2%",
                "mData": function () {
                    return i;
                }
            },    
            { "sTitle": "商家id", "mData": "id", "sWidth": "10%" },
            { "sTitle": "商家名", "mData": "name", "sWidth": "10%" },
            { "sTitle": "地址", "mData": "address", "sWidth": "10%" },
            { "sTitle": "电话", "mData": "tel", "sWidth": "10%" },
            { "sTitle": "发布时间", "mData": "createTime", "sWidth": "10%" },
            { "sTitle": "操作", "sWidth": "10%",
                "mData": function (data) {
                    var status = '<a href="' + _path + '/mall/edit/' + data.id + '" class="btn default btn-xs purple"><i class="fa fa-edit" title="编辑"></i></a>';
                    status += '<a href="' + _path + '/mall/del/' + data.id + '"  class="btn default btn-xs red"><i class="fa fa-trash-o" title="删除"></i></a>';
                    status += '<a href="' + _path + '/maid/list?type=1' + data.id + '"  class="btn default btn-xs  ">发放本月佣金</a>';

                    return status;
                }
            }
        ]
    });
    

}


